package com.usian.job;

import com.usian.feign.WemediaFeign;
import com.usian.service.WemediaNewsAutoScanService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class WeMediaNewsAutoScanJob {

    @Autowired
    private WemediaFeign wemediaFeign;
    @Autowired
    private WemediaNewsAutoScanService wemediaNewsAutoScanService;

    @XxlJob("wenzhang")
    public ReturnT<String> hello(String param) throws Exception {

        //1：查询文章wmnews status 8 且 发布时间小于当前时间  集合
        List<Integer> list = wemediaFeign.findWmnews();
        for(Integer newId : list){
            wemediaNewsAutoScanService.autoScanByMediaNewsId(newId);
        }

        return ReturnT.SUCCESS;
    }
}
